#include "widget.h"
#include "./ui_widget.h"

#include <QMessageBox>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    tcpSocket = new QTcpSocket(this);
    tcpSocket->connectToHost(QHostAddress("10.11.17.59"), 1234);

    connect(tcpSocket, &QTcpSocket::readyRead, this, &Widget::readyReadSlots);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::readyReadSlots()
{
    char buf[1024] = {};
    tcpSocket->read(buf, 1024);
    QMessageBox::information(this, QString("收到："), QString(buf));
}
